﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;

using LINQToolKit.Mapping;

namespace LINQToolKit.Processors
{
    public abstract class PropertyProcessor : IXmlPropertyProcessor
    {
        public virtual bool Reuseable
        {
            get { return true; }
        }

        public object FromXml(MetaProperty meta, string xml)
        {
            meta.AssertNull("meta");
            xml.AssertNull("xml");

            XElement element = XElement.Parse(xml);
            return this.FromXml(meta, new XElement[]{element});
        }

        public abstract object FromXml(MetaProperty meta, IEnumerable<XElement> elements);
    }
}
